
<div :class="[$store.state.appPrefix + '-p-course-list-index', 'g-table-layout']">
  <div class="g-table-header">
    <div class="g-table-header-wrap">
      <div class="g-table-header__title">课程管理</div>
      <div class="g-table-header__desc">企业人员快速创建课程，实现高效课程管理</div>
    </div>
    <div class="g-table-header__extra">
      <el-button type="primary" size="small" icon="el-icon-plus" @click="editDialogVisible = true">创建课程</el-button>
    </div>
  </div>
  <div class="g-table-main">    
    <div class="g-table-top g-table-top-action__flex g-table-top-action__flex--br">
      <div class="g-table-top-action__left">
        <div class="g-table-main-title">课程列表</div>
      </div>
      <div class="g-table-top-action__right">
        <el-search
          size="small"
          v-model="filterForm.q"
          class="g-table-top-action__left--block g-table-top-action__left--row"
          isBasic
          @search="$search"
          @clear="() => {filterForm.q = ''; $search()}"
          placeholder="请输入课程名称">
        </el-search>
        <!-- <el-select
          class="g-table-top-action__left--block g-table-top-action__left--row"
          v-model="filterForm[FILTER_PARAMS.expiredStatus.interfaceParam]"
          placeholder="选择授权状态"
          clearable
          @change="$search">
          <el-option
            v-for="item in PUBLIST_STATUS"
            :key="item.codeNum"
            :label="item.codeName"
            :value="item.codeNum">
          </el-option>
        </el-select> -->
        <!-- <el-button type="primary" icon="el-icon-plus" @click="$handleAdd">新增</el-button> -->
      </div>
    </div>
    <el-table v-loading="isPageLoading" :height="tableHeight" :data="tableList" @sort-change="$sortChange">
      <el-table-column
        label="序号"
        type="index">
      </el-table-column>
      <el-table-column
        v-for="col in COL_INDEXS"
        :key="col.prop"
        :prop="col.prop"
        :label="col.label"
        show-overflow-tooltip
        :sortable="col.isSort ? 'custom' : false"
        :min-width="col.minWidth || 120">
        <template slot-scope="scope">
          <span v-if="col.isDict">
            <el-tag size="mini" :type="(col.dictType[scope.row[col.prop]] || {}).tag">{{(col.dictType[scope.row[col.prop]] || {}).codeName | filterBlank}}</el-tag>
          </span>
          <span v-else-if="col.isBar">
            <el-progress v-if="scope.row[col.prop] < 100" :percentage="scope.row[col.prop]" :format="barFormat"></el-progress>
            <el-progress v-else :percentage="scope.row[col.prop]" status="success"></el-progress>
          </span>
          <span v-else-if="col.unit">{{scope.row[col.prop] || 0}}{{col.unit}}</span>
          <span class="status-deco" v-else-if="col.prop === 'deadlineTime'">
            <span v-if="scope.row.deadlineTime === '已截止'" class="dot"></span>
            {{scope.row[col.prop] | filterBlank}}
          </span>
          <span v-else>{{scope.row[col.prop] | filterBlank}}{{col.unit}}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        fixed="right"
        :width="200"
        class-name="no-ellipsis">
        <template slot-scope="scope">
          <div class="btns">
            <el-button type="text" size="medium" @click="$handlePeriod(scope.row)">课时管理</el-button>
            <el-button type="text" size="medium" @click="$handleTrainee(scope.row)">学员管理</el-button>
            <el-dropdown size="small" trigger="click">
              <el-button type="text" size="medium" icon="el-icon-more"></el-button>
              <el-dropdown-menu slot="dropdown" :class="$store.state.appPrefix + '-c-table-dropdown'">
                <el-dropdown-item
                  class="clearfix"
                  @click.native="$handleEdit(scope.row)">课程信息</el-dropdown-item>
                <el-dropdown-item
                  class="clearfix"
                  @click.native="$handleLessonData(scope.row)">学习数据</el-dropdown-item>
                <el-dropdown-item
                  class="clearfix"
                  @click.native="$handleDelete(scope.row)">删除课程</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="g-table-bottom g-pagination"
      background
      :hide-on-single-page="true"
      :layout="PAGE_CONFIG.simpleLayout"
      :total="totalCount"
      :page-size="pageSize"
      :current-page.sync="pageNo"
      @current-change="$handlePageChange">
    </el-pagination>
  </div>

  <add-dialog :dialogVisible.sync="editDialogVisible" @saveSucc="$addSuccess"></add-dialog>
</div>
